﻿Imports System.Data.OleDb

Partial Class DiscussionBoard
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim oleDBConn As New OleDbConnection(ConfigurationManager.ConnectionStrings("AllAboutForexDBConnectionString").ConnectionString)
        oleDBConn.Open()

        If IsPostBack Then

            Dim sqlst = "INSERT INTO DISCUSSIONS ([Subject],[Details],[User],[DiscDate]) VALUES (@Subject, @Details,@User,@DiscDate)"
            Dim discmd1 As New OleDbCommand(sqlst, oleDBConn)
            discmd1.Parameters.AddWithValue("@Subject", txtTopic.Text)
            discmd1.Parameters.AddWithValue("@Details", txtPostDet.Text)
            discmd1.Parameters.AddWithValue("@User", User.Identity.Name)
            discmd1.Parameters.AddWithValue("@DiscDate", DateTime.Now.Date)
            discmd1.ExecuteNonQuery()

        Else

            Session("QryStr") = Request.QueryString("Field")
        End If


        Dim myid = Session("QryStr")

        Dim discstrg As String = "Select * From Discussions Where [Subject] = ?"
        Dim discmd As New OleDbCommand(discstrg, oleDBConn)
        discmd.Parameters.AddWithValue("Subject", myid)
        Dim dbread = discmd.ExecuteReader()
        Repeater1.DataSource = dbread
        Repeater1.DataBind()
    End Sub

    Protected Sub txtTopic_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtTopic.TextChanged

    End Sub
End Class
